package cn.iocoder.yudao.module.system.dal.mysql.monitor;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.system.dal.dataobject.monitor.MonitorDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.system.controller.admin.monitor.vo.*;

/**
 * 监控内容 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface MonitorMapper extends BaseMapperX<MonitorDO> {

    default PageResult<MonitorDO> selectPage(MonitorPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MonitorDO>()
                .eqIfPresent(MonitorDO::getType, reqVO.getType())
                .betweenIfPresent(MonitorDO::getDate, reqVO.getDate())
                .betweenIfPresent(MonitorDO::getStartTime, reqVO.getStartTime())
                .betweenIfPresent(MonitorDO::getEndTime, reqVO.getEndTime())
                .eqIfPresent(MonitorDO::getValue, reqVO.getValue())
                .betweenIfPresent(MonitorDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(MonitorDO::getId));
    }

}